load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "bindinfo",
    srcs = [
        "binding.go",
        "binding_cache.go",
        "binding_match.go",
        "capture.go",
        "global_handle.go",
        "session_handle.go",
        "util.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/bindinfo",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/bindinfo/internal/logutil",
        "//pkg/bindinfo/norm",
        "//pkg/kv",
        "//pkg/metrics",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/format",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/planner/core/resolve",
        "//pkg/sessionctx",
        "//pkg/sessionctx/sessionstates",
        "//pkg/sessionctx/stmtctx",
        "//pkg/sessionctx/variable",
        "//pkg/types",
        "//pkg/types/parser_driver",
        "//pkg/util",
        "//pkg/util/chunk",
        "//pkg/util/hack",
        "//pkg/util/hint",
        "//pkg/util/intest",
        "//pkg/util/kvcache",
        "//pkg/util/mathutil",
        "//pkg/util/memory",
        "//pkg/util/parser",
        "//pkg/util/sqlexec",
        "//pkg/util/stmtsummary/v2:stmtsummary",
        "//pkg/util/stringutil",
        "//pkg/util/table-filter",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@org_golang_x_sync//singleflight",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "bindinfo_test",
    timeout = "moderate",
    srcs = [
        "binding_cache_test.go",
        "binding_match_test.go",
        "capture_test.go",
        "fuzzy_binding_test.go",
        "global_handle_test.go",
        "main_test.go",
        "optimize_test.go",
        "session_handle_test.go",
    ],
    embed = [":bindinfo"],
    flaky = True,
    race = "on",
    shard_count = 50,
    deps = [
        "//pkg/bindinfo/internal",
        "//pkg/bindinfo/norm",
        "//pkg/config",
        "//pkg/domain",
        "//pkg/meta/model",
        "//pkg/parser",
        "//pkg/parser/ast",
        "//pkg/parser/auth",
        "//pkg/parser/format",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/server",
        "//pkg/session/types",
        "//pkg/sessionctx/variable",
        "//pkg/testkit",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/hack",
        "//pkg/util/parser",
        "//pkg/util/stmtsummary",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_stretchr_testify//require",
        "@io_opencensus_go//stats/view",
        "@org_uber_go_goleak//:goleak",
    ],
)
